package com.jred.jforum.actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.jred.jforum.IConst;
import com.jred.jforum.actions.common.TDDispatchAction;
import com.jred.jforum.beans.user.User;
import com.jred.jforum.exception.JForumException;
import com.jred.jforum.service.ForumService;

public class ShowMainPageAction extends TDDispatchAction {

	/**
	 * ��ҳ
	 * 
	 */
	public ActionForward main(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws JForumException {
		
		response.setContentType("text/html");
		HttpSession session = request.getSession();
		User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
		
		ForumService forumService = (ForumService)getServiceFacade("forumService");
		request.setAttribute("JFORUM_GROUPS", forumService.getGroups());
		// TODO Auto-generated method stub
		return (mapping.findForward("welcome"));
	}

}
